package Hxw3DEngine.core.materials.shader.utils {

	public class ShaderRegisterElement {
		
		/** 寄存器名称 */
		private var _regName : String;
		/** 寄存器索引 */
		private var _index   : int;
		// 寄存器
		private var _reg  	 : String;
		//寄存器描述
		private var _des	 :String;
		
		/**
		 *  
		 * @param regName	寄存器名称
		 * @param index		寄存器索引
		 * 
		 */		
		public function ShaderRegisterElement(regName : String, index : int,des:String = "") {
			this._regName = regName;
			this._index   = index;
			this._des = des;
			this._reg 	  = regName + index;
		}
		
		//该寄存器的注释
		public function get des():String {
			return _des;
		}
		
		public function set des(val:String):void {
			_des = val;
		}
		
		/**
		 * 寄存器名称
		 */
		public function get regName() : String {
			return this._regName;
		}
		
		/**
		 * 寄存器索引
		 */
		public function get index() : int {
			return this._index;
		}
		
		/**
		 * 寄存器 
		 * @return 
		 * 
		 */		
		public function get reg() : String {
			return _reg;
		}
		
		public function getReg(ind:int = 0):String{
			if(ind == 0){
				return _reg;
			}else{
				return regName + (index+ind).toString();
			}
		}
		
		/**
		 * 寄存器 
		 * @return 
		 * 
		 */		
		public function toString() : String {
			return _reg;	
		}
		
		public function get x():String {
			return _reg + ".x";
		}
		
		public function get xxxx():String {
			return _reg + ".xxxx";
		}
		
		public function get yyyy():String {
			return _reg + ".yyyy";
		}
		
		public function get zzzz():String {
			return _reg + ".zzzz";
		}
		
		public function get wwww():String {
			return _reg + ".wwww";
		}
		
		public function get y():String {
			return _reg + ".y";
		}
		
		public function get z():String {
			return _reg + ".z";
		}
		
		public function get w():String {
			return _reg + ".w";
		}
		
		public function get xy():String {
			return _reg + ".xy";
		}
		
		public function get xyxy():String {
			return _reg + ".xyxy";
		}
		
		public function get xyz():String {
			return _reg + ".xyz";
		}
		
		public function get xyzz():String {
			return _reg + ".xyzz";
		}
		
		public function get xyzw():String {
			return _reg + ".xyzw";
		}
		
		public function get zwzw():String {
			return _reg + ".zwzw";
		}
		
	}
}
